#include <bits/stdc++.h>
#include "vector.hpp"
using namespace std;

inline void read(Vector <int> & a){
	int n;
	cin >> n;
	a = Vector <int> (n);
	for(int i = 0; i < n; ++i) cin >> a[i];
}

inline void print(const Vector <int> & a) {
	cout << (a.empty() ? "Empty" : "Not Empty") << endl;
	cout << "Size: " << a.size() << endl;
	cout << "Capacity: " << a.capacity() << endl;
	cout << "Elements:" << endl;
	for(int i = 0; i < a.size(); ++i) cout << a[i] << " ";
	cout << endl << endl;
}

int main(){
	int n, x, y;
	
	cout << "Construction:" << endl;
	Vector <int> a;
	Vector <int> b;
	read(b);
	Vector <int> c = b;
	cout << "A: " << endl, print(a);
	cout << "B: " << endl, print(b);
	cout << "C: " << endl, print(c);
	
	cout << "Test Modify in C:" << endl;
	for(int i = 0; i < c.size(); ++i) c[i] = c[i] * 2 + 1;
	print(c);
	
	cout << "Test Push_back in C:" << endl;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> x;
		cout << "Push " << x << " to the back of C" << endl;
		c.push_back(x);
		print(c);
	}
	
	cout << "Test Pop_back in B:" << endl;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cout << "Pop " << i+1 << " time(s) from the back of B" << endl;
		b.pop_back();
		print(b);
	}
	cout << endl;
	
	cout << "Test Insert in C:" << endl;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> x >> y;
		cout << "Insert " << x << " between position " << y << " and " << y+1 << endl;
		c.insert(x, y);
		print(c);
	}
	cout << endl;
	
	cout << "Test Iterator in B:" << endl;
	for(Vector <int> :: iterator it = b.begin(); it != b.end(); ++it)
		cout << *it << endl;
	cout << endl;
	
	cout << "Test Find in C:" <<endl;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> x;
		cout << "Find " << x << endl;
		Vector <int> :: iterator it = c.find(x);
		if(it == c.end()) cout << "Not Found!" << endl;
		else cout << "Found " << x << " at position " << it - c.begin() << endl;
	}
}